package edu.uc.ui;

import com.foodview1.R;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;

/**
 * This activity is stubbed in to control the search page that will
 * allow the user to search for food by many different criteria including
 * food type, relative location, review rating, etc.
 * 
 * in the future this class will handle searching the database to display reviews from
 * other FoodView users.
 * @author Ckorczyk1
 *
 */
public class SearchActivity extends MainActivity {
	/**
	 * onCreate method
	 * @param = Bundle SavedInstanceState
	 *  
	 */

	@Override
	public void onCreate(Bundle savedInstanceState) {
		setTitle("Food View");
		super.onCreate(savedInstanceState);
		setContentView(R.layout.search_food);
		
		// create new cancel button object to bring you back to the main screen
				Button btnCancelSearch = (Button)findViewById(R.id.btnCancelSearch);
				// Register the onClick listener
				btnCancelSearch.setOnClickListener(new OnClickListener() {

					/**
					 * onClick method
					 */
					@Override
					public void onClick(View v) {
						// TODO Auto-generated method stub
						Intent clickLogin = new Intent(v.getContext(), MainActivity.class);
						startActivityForResult(clickLogin, 0);
						finish();
					}
				});
				
				// Create new submit search button object
				Button btnSubmitSearch = (Button)findViewById(R.id.btnSubmitSearch);
				// Register the onClick listener
				btnSubmitSearch.setOnClickListener(new OnClickListener(){
					/**
					 * onClick method
					 * 
					 */
					@Override
					public void onClick(View arg){

						//call the popup method and display the message below
						//this is temporary until scrum sprint 3
						popup("This button will search the database for restaurants.");

					}
				});
	}
	
	// Declare popup message function
	protected void popup(String message){
		Toast.makeText(this, message, Toast.LENGTH_LONG).show();
	}
}
